home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-22 | 1.9 KB | 81 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 2 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //===============================================================
- #ifndef COMMANDS_H
- #include "Commands.h" // CPizzaCommand
- #endif
-
- #ifndef PIZZA_H
- #include "Pizza.h" // CPizza
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h" // CDataCopyContent
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k" // command numbers
- #endif
-
- //===============================================================
- #ifdef FW_BUILD_MAC
- #pragma segment DataCopy
- #endif
-
- FW_DEFINE_AUTO(CPizzaCommand)
-
- //===============================================================
- CPizzaCommand::CPizzaCommand(Environment* ev,
- ODCommandID id,
- FW_CFrame* frame,
- CDataCopyContent* content,
- FW_CPoint position)
- : FW_CCommand(ev, id, frame, FW_kCanUndo),
- fContent(content),
- fPizza(NULL)
- {
- this->SetMenuStringsFromResource(ev, kUndoStringsID,
- kUndoMakePizzaMsg, kRedoMakePizzaMsg);
- FW_CPoint halfSize( FW_IntToFixed(15), FW_IntToFixed(15) );
- FW_CRect bounds(position - halfSize, position + halfSize);
- fPizza = new CPizza(bounds);
-
- FW_END_CONSTRUCTOR
- }
-
- //---------------------------------------------------------------
- CPizzaCommand::~CPizzaCommand()
- {
- FW_START_DESTRUCTOR
- }
-
- //---------------------------------------------------------------
- void
- CPizzaCommand::DoIt(Environment* ev)
- {
- fContent->MyAddPizza(ev, fPizza); // add a pizza
- }
-
- //---------------------------------------------------------------
- void
- CPizzaCommand::UndoIt(Environment* ev)
- {
- fContent->MyRemoveLastPizza(ev, fPizza); // remove a pizza
- }
-
- //---------------------------------------------------------------
- void
- CPizzaCommand::RedoIt(Environment* ev)
- {
- this->DoIt(ev);
- }
-
- //---------------------------------------------------------------
- void
- CPizzaCommand::FreeRedoState(Environment* ev)
- {
- FW_UNUSED(ev);
- delete fPizza;
- }
-